home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-11-15 | 1.8 KB | 77 lines |
-
- package applets;
-
- import shout3d.*;
- import shout3d.core.*;
- import shout3d.math.*;
-
-
- public class ChangeSegments2Panel extends Shout3DPanel implements DeviceObserver {
-
-
- TimeSensor timer;
- FractionRemapper fr;
- float[] first = {0.0f, .19f};
- float[] second = {.2f, 1.0f};
- boolean firstseg = false;
-
-
- public ChangeSegments2Panel (Shout3DApplet applet){
- super(applet);
- }
-
- public void customInitialize() {
- addDeviceObserver(this,"MouseInput", null);
-
-
- timer = (TimeSensor) getNodeByName("timer");
- fr = (FractionRemapper) getNodeByName("fr");
-
- }
-
-
- protected void finalize() {
- removeDeviceObserver(this,"MouseInput");
-
- }
-
-
-
- public boolean onDeviceInput(DeviceInput di, Object userData) {
- MouseInput mi = (MouseInput) di;
- switch (mi.which){
-
- case MouseInput.DOWN:
-
- if(firstseg) {
-
- timer.loop.setValue(false);
- timer.stop();
- timer.cycleInterval.setValue(8.0);
- fr.startKey.setValue(second[0]);
- fr.endKey.setValue(second[1]);
- timer.start();
- timer.loop.setValue(true);
- firstseg = false;
- return true;
- }
- else {
- timer.loop.setValue(false);
- timer.stop();
- timer.cycleInterval.setValue(2.0);
- fr.startKey.setValue(first[0]);
- fr.endKey.setValue(first[1]);
- timer.start();
- timer.loop.setValue(true);
-
- firstseg = true;
- return true;
- }
-
- }//end of switch
-
- return false;
- }
-
-
- }//end of class